/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exatrez.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author fikri
 */
@Entity
@Table(name = "inbox")
@NamedQueries({
    @NamedQuery(name = "Inbox.findAll", query = "SELECT i FROM Inbox i")})
public class Inbox implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "inbox_id")
    private Integer inboxId;
    @Basic(optional = false)
    @Column(name = "sender_email")
    private String senderEmail;
    
    @Basic(optional = false)
    @Column(name = "receiver_email")
    private String receiverEmail;
    
    @Column(name = "title")
    private String title;
     @Column(name = "content")
    private String content;
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "inbox_status")
    private InboxStatusCode status;
    
    @Embedded
    private InfoAudit infoAudit;
    
  

    public Inbox() {
    }

    public Inbox(Integer inboxId) {
        this.inboxId = inboxId;
    }

    public Inbox(Integer inboxId, String senderEmail, String receiverEmail) {
        this.inboxId = inboxId;
        this.senderEmail = senderEmail;
        this.receiverEmail = receiverEmail;
    }

    public Integer getInboxId() {
        return inboxId;
    }

    public void setInboxId(Integer inboxId) {
        this.inboxId = inboxId;
    }

    public String getSenderEmail() {
        return senderEmail;
    }

    public void setSenderEmail(String senderEmail) {
        this.senderEmail = senderEmail;
    }

    public String getReceiverEmail() {
        return receiverEmail;
    }

    public void setReceiverEmail(String receiverEmail) {
        this.receiverEmail = receiverEmail;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public InboxStatusCode getStatus() {
        return status;
    }

    public void setStatus(InboxStatusCode status) {
        this.status = status;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public InfoAudit getInfoAudit() {
        return infoAudit;
    }

    public void setInfoAudit(InfoAudit infoAudit) {
        this.infoAudit = infoAudit;
    }

    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (inboxId != null ? inboxId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Inbox)) {
            return false;
        }
        Inbox other = (Inbox) object;
        if ((this.inboxId == null && other.inboxId != null) || (this.inboxId != null && !this.inboxId.equals(other.inboxId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "exatrez.model.Inbox[ inboxId=" + inboxId + " ]";
    }
    
}
